package cn.flying.cloud.flow.entity;

import java.io.Serializable;
import java.time.LocalDateTime;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.Version;

import cn.flying.cloud.flow.bo.FwProcExceptionBo;

/**
 * 异常信息表
 *
 * @author admin
 * @since 2025-09-24 22:32:54
 */
@TableName("fw_proc_exception")
public class FwProcException implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 主键ID
     */
    @TableId(value = "id", type = IdType.ASSIGN_ID)
    private Long id;

    /**
     * 流程实例ID
     */
    @TableField("proc_inst_id")
    private String procInstId;

    /**
     * 流程实例名称
     */
    @TableField("proc_inst_name")
    private String procInstName;

    /**
     * 流程执行ID
     */
    @TableField("execution_id")
    private String executionId;

    /**
     * 流程定义ID
     */
    @TableField("proc_def_id")
    private String procDefId;

    /**
     * 流程定义Key
     */
    @TableField("proc_def_key")
    private String procDefKey;

    /**
     * 流程定义name
     */
    @TableField("proc_def_name")
    private String procDefName;

    /**
     * 节点ID
     */
    @TableField("node_id")
    private String nodeId;

    /**
     * 节点名称
     */
    @TableField("node_name")
    private String nodeName;

    /**
     * 业务流水号
     */
    @TableField("biz_key")
    private String bizKey;

    /**
     * 异常信息
     */
    @TableField("exception_msg")
    private String exceptionMsg;

    /**
     * 异常栈信息
     */
    @TableField("exception_trace")
    private String exceptionTrace;

    /**
     * 处理状态
     */
    @TableField("deal_state")
    private String dealState;

    /**
     * 创建人
     */
    @TableField(value = "created_by", fill = FieldFill.INSERT)
    private String createdBy;

    /**
     * 创建时间
     */
    @TableField(value = "created_time", fill = FieldFill.INSERT)
    private LocalDateTime createdTime;

    /**
     * 更新人
     */
    @TableField(value = "updated_by", fill = FieldFill.INSERT_UPDATE)
    private String updatedBy;

    /**
     * 更新时间
     */
    @TableField(value = "updated_time", fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updatedTime;

    /**
     * 租户号
     */
    @TableField("tenant_id")
    private String tenantId;

    /**
     * 乐观锁
     */
    @TableField(value = "revision", fill = FieldFill.INSERT)
    @Version
    private Long revision;

    /**
     * 删除标识
     */
    @TableField(value = "deleted", fill = FieldFill.INSERT)
    @TableLogic
    private String deleted;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getProcInstId() {
        return procInstId;
    }

    public void setProcInstId(String procInstId) {
        this.procInstId = procInstId;
    }

    public String getProcInstName() {
        return procInstName;
    }

    public void setProcInstName(String procInstName) {
        this.procInstName = procInstName;
    }

    public String getExecutionId() {
        return executionId;
    }

    public void setExecutionId(String executionId) {
        this.executionId = executionId;
    }

    public String getProcDefId() {
        return procDefId;
    }

    public void setProcDefId(String procDefId) {
        this.procDefId = procDefId;
    }

    public String getProcDefKey() {
        return procDefKey;
    }

    public void setProcDefKey(String procDefKey) {
        this.procDefKey = procDefKey;
    }

    public String getProcDefName() {
        return procDefName;
    }

    public void setProcDefName(String procDefName) {
        this.procDefName = procDefName;
    }

    public String getNodeId() {
        return nodeId;
    }

    public void setNodeId(String nodeId) {
        this.nodeId = nodeId;
    }

    public String getNodeName() {
        return nodeName;
    }

    public void setNodeName(String nodeName) {
        this.nodeName = nodeName;
    }

    public String getBizKey() {
        return bizKey;
    }

    public void setBizKey(String bizKey) {
        this.bizKey = bizKey;
    }

    public String getExceptionMsg() {
        return exceptionMsg;
    }

    public void setExceptionMsg(String exceptionMsg) {
        this.exceptionMsg = exceptionMsg;
    }

    public String getExceptionTrace() {
        return exceptionTrace;
    }

    public void setExceptionTrace(String exceptionTrace) {
        this.exceptionTrace = exceptionTrace;
    }

    public String getDealState() {
        return dealState;
    }

    public void setDealState(String dealState) {
        this.dealState = dealState;
    }

    public String getCreatedBy() {
        return createdBy;
    }

    public void setCreatedBy(String createdBy) {
        this.createdBy = createdBy;
    }

    public LocalDateTime getCreatedTime() {
        return createdTime;
    }

    public void setCreatedTime(LocalDateTime createdTime) {
        this.createdTime = createdTime;
    }

    public String getUpdatedBy() {
        return updatedBy;
    }

    public void setUpdatedBy(String updatedBy) {
        this.updatedBy = updatedBy;
    }

    public LocalDateTime getUpdatedTime() {
        return updatedTime;
    }

    public void setUpdatedTime(LocalDateTime updatedTime) {
        this.updatedTime = updatedTime;
    }

    public String getTenantId() {
        return tenantId;
    }

    public void setTenantId(String tenantId) {
        this.tenantId = tenantId;
    }

    public Long getRevision() {
        return revision;
    }

    public void setRevision(Long revision) {
        this.revision = revision;
    }

    public String getDeleted() {
        return deleted;
    }

    public void setDeleted(String deleted) {
        this.deleted = deleted;
    }

    @Override
    public String toString() {
        return "FwProcException{" +
                "id = " + id +
                ", procInstId = " + procInstId +
                ", procInstName = " + procInstName +
                ", executionId = " + executionId +
                ", procDefId = " + procDefId +
                ", procDefKey = " + procDefKey +
                ", procDefName = " + procDefName +
                ", nodeId = " + nodeId +
                ", nodeName = " + nodeName +
                ", bizKey = " + bizKey +
                ", exceptionMsg = " + exceptionMsg +
                ", exceptionTrace = " + exceptionTrace +
                ", dealState = " + dealState +
                ", createdBy = " + createdBy +
                ", createdTime = " + createdTime +
                ", updatedBy = " + updatedBy +
                ", updatedTime = " + updatedTime +
                ", tenantId = " + tenantId +
                ", revision = " + revision +
                ", deleted = " + deleted +
                "}";
    }

    public FwProcExceptionBo toBO() {
        FwProcExceptionBo bo = new FwProcExceptionBo();
        bo.setId(this.id);
        bo.setProcInstId(this.procInstId);
        bo.setProcInstName(this.procInstName);
        bo.setExecutionId(this.executionId);
        bo.setProcDefId(this.procDefId);
        bo.setProcDefKey(this.procDefKey);
        bo.setProcDefName(this.procDefName);
        bo.setNodeId(this.nodeId);
        bo.setNodeName(this.nodeName);
        bo.setBizKey(this.bizKey);
        bo.setExceptionMsg(this.exceptionMsg);
        bo.setExceptionTrace(this.exceptionTrace);
        bo.setDealState(this.dealState);
        bo.setCreatedBy(this.createdBy);
        bo.setCreatedTime(this.createdTime);
        bo.setUpdatedBy(this.updatedBy);
        bo.setUpdatedTime(this.updatedTime);
        bo.setTenantId(this.tenantId);
        bo.setRevision(this.revision);
        bo.setDeleted(this.deleted);
        return bo;
    }

    public FwProcException fromBO(FwProcExceptionBo bo) {
        this.setId(bo.getId());
        this.setProcInstId(bo.getProcInstId());
        this.setProcInstName(bo.getProcInstName());
        this.setExecutionId(bo.getExecutionId());
        this.setProcDefId(bo.getProcDefId());
        this.setProcDefKey(bo.getProcDefKey());
        this.setProcDefName(bo.getProcDefName());
        this.setNodeId(bo.getNodeId());
        this.setNodeName(bo.getNodeName());
        this.setBizKey(bo.getBizKey());
        this.setExceptionMsg(bo.getExceptionMsg());
        this.setExceptionTrace(bo.getExceptionTrace());
        this.setDealState(bo.getDealState());
        this.setCreatedBy(bo.getCreatedBy());
        this.setCreatedTime(bo.getCreatedTime());
        this.setUpdatedBy(bo.getUpdatedBy());
        this.setUpdatedTime(bo.getUpdatedTime());
        this.setTenantId(bo.getTenantId());
        this.setRevision(bo.getRevision());
        this.setDeleted(bo.getDeleted());
        return this;
    }
}
